//简单哈希

#include <stdio.h>

#define MAX_SIZE 10

int hashFunc(int v) {
	return v % MAX_SIZE;
}

void init(int data[], int dataSize, int arr[]) {
	for (int i = 0; i < dataSize; i++) {
		int hashAddr = hashFunc(data[i]);
		arr[hashAddr] = data[i];
	}
}

void verify(int arr[], int v) {
	if (arr[hashFunc(v)] == v)
		printf("true");
	else
		printf("false");
}

void arrPrint(int arr[], int n) {
	for (int i = 0; i < n; i++) {
		printf("%d\n", arr[i]);
	}
}

void test() {
	printf("initial data { 3,5,11,12 }\n");

	int array[MAX_SIZE] = { 0 };
	int data[4] = { 3,5,11,12 };

	init(data, sizeof(data) / sizeof(data[0]), array);

	arrPrint(array, sizeof(array) / sizeof(array[0]));

	printf("Please enter the query number:\n");

	int in = 0;
	scanf_s("%d", &in);

	verify(array, in);
}

//int main(void) {
//	test();
//	return 0;
//}